<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Services\AiZhanService;
use Illuminate\Http\Request;

class AiZhanController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }


    public function siteinfos(Request $request)
    {
        $tourl=$request->input('tourl');
        $type=$request->input('type');
        $aizhan=new AiZhanService();
        try {
            $data = $aizhan->quanz($type,$tourl);
        } catch (\Exception $e) {
            return $this->error($e->getMessage());
        }
        return $this->success('success',$data);
    }

    public function icpBeian(Request $request)
    {
        $tourl=$request->input('tourl');
        $aizhan=new AiZhanService();
        try {
            $data = $aizhan->icpbeian($tourl);
        } catch (\Exception $e) {
            return $this->error($e->getMessage());
        }
        return $this->success('success',$data);
    }

    public function intercept(Request $request)
    {
        $tourl=$request->input('tourl');
        $aizhan=new AiZhanService();
        try {
            $data = $aizhan->intercept($tourl);
        } catch (\Exception $e) {
            return $this->error($e->getMessage());
        }
        return $this->success('success',$data);
    }
}
